package com.itheima.homework7;

import java.io.File;

public class Demo7_DeleteDir {
    public static void main(String[] args) {
        //F:\javase_42
        File dir = new File("F:\\javase_42");
        deleteDir(dir);
    }

    public static void deleteDir(File dir) {
        File[] dirArr = dir.listFiles();
        if (dirArr != null) {
            for (File file : dirArr) {
                if (file.isFile()) {
                    file.delete();
                }
                deleteDir(file);
            }
        }
        dir.delete();
    }
}
